package com.qfjy.project.weixin.api.hitokoto;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate;

/**
 * @ClassName HitokotoUtil
 * @Description TODO
 * @Author guoweixin
 * @Date 2022/11/30
 * @Version 1.0
 */
@Component
@Slf4j
public class HitokotoUtil {

    /**一言服务器API地址 */
    private  static final String HITOKOTO_URL="https://v1.hitokoto.cn/?encode=text";

    @Autowired
    private RestTemplate restTemplate;

    public String getResult(){

        String result=restTemplate.getForObject(HITOKOTO_URL,String.class);
        return result;
    }
}
